package com.atmk.atmk.designMode.创建型.建造者模式.使用者;


import com.atmk.atmk.designMode.创建型.建造者模式.产品角色.House;
import com.atmk.atmk.designMode.创建型.建造者模式.具体建造者.CommonHouse;
import com.atmk.atmk.designMode.创建型.建造者模式.具体建造者.HighBuilding;
import com.atmk.atmk.designMode.创建型.建造者模式.指挥者.HouseDirector;

public class Client {
    public static void main(String[] args) {

        ///盖普通房子
        //准备创建房子的指挥者
        HouseDirector houseDirector = new HouseDirector(new CommonHouse());
        //完成盖房子，返回产品(普通房子)
        House commonHouse = houseDirector.constructHouse();
        System.out.println("普通房子：" + commonHouse.toString());

        System.out.println("---------------------------------------------------------------------------------------------");
        ///盖高楼
        //重置建造者，改成修高楼
        houseDirector.setHouseBuilder(new HighBuilding());
        //完成盖房子，返回产品(高楼)
        House highBuilding = houseDirector.constructHouse();
        System.out.println("高楼：" + highBuilding.toString());
    }
}